package sistemioperativi.interruzioni.es4;

import java.util.Scanner;

public class CronometroRunnable implements Runnable {

		
	int contatore = 0;
	int pause = 0;

	Scanner sc = new Scanner(System.in);
	public void run() {
		
		while(true){
		while(!Thread.currentThread().isInterrupted()){
			
			try{
				Thread.currentThread().sleep(1000);
				System.out.println("\n"+contatore);
				contatore++;
			}catch(InterruptedException e){
				
				System.out.println("Interruzione "+pause);
				pause++;
				System.out.println("Invio per interrompere la pausa");
				sc.nextLine();
			}
		}
			
		}
		
	}
}//EOC


